**************************************************************************************************
*** This do file creates the replication results for 
*** Earthquake Propensity and the Politics of Mortality Prevention							 	*/
*** Phil Keefer (World Bank)																	*/
*** Eric Neumayer (LSE)																			*/
*** Thomas Pl�mper (University of Essex)														*/
*** Published in: World Development, 39 (9), 2011, pp. 1530-1541													*/
**************************************************************************************************
**************************************************************************************************
/* Note: 
You have to change "local DIR" to the directory you copy the original stata files contained 	*/
/* in the zip file and then run the do file. 													*/
**************************************************************************************************

version 11.0
drop _all
clear matrix
clear mata
set mem 800m
set mat 500

capture net install outreg2, from(http://fmwww.bc.edu/RePEc/bocode/o)			/* checks whether outreg2 is installed 		*/

***********************************************************************************
local DIR = "C:\Research\Disasters\World Bank data"  /*change relative path to the directory where the files are located */
cd "`DIR'"
***********************************************************************************

use "Article for World Development (earthquakes).dta", clear


*** Table 1: Main model

** Sum of quake strengths above 6 as propensity var

* Model 1: No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    sumactualmaxmagabove610  dem5_polity  lngdppc   lnpop   if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table1, replace excel
su year if e(sample)

* Model 2: Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.sumactualmaxmagabove610  dem5_polity  lngdppc   lnpop       if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table1, append excel
* Testing equality of coefficients
test 1.inc_developed#c.sumactualmaxmagabove610=0.inc_developed#c.sumactualmaxmagabove610
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove610) at(inc_developed=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj   dem5_polity  lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]
su year if e(sample)

* Model 3: Different elasticities of earthquake propensity variable in democracies versus autocracies (Polity definition)
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj dem5_polity#c.sumactualmaxmagabove610   dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table1, append excel
* Testing equality of coefficients
test 1.dem5_polity#c.sumactualmaxmagabove610 =0.dem5_polity#c.sumactualmaxmagabove610 
* Testing equality in average marginal effect at mean co-variate values
quietly xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj dem5_polity##c.sumactualmaxmagabove610     lngdppc   lnpop       if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
margins, dydx(sumactualmaxmagabove610) at(dem5_polity=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj     lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]
su year if e(sample)

* Model 4: Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*sumactualmaxmagabove610
ge demoldprop=(dem5_polity)*  regimestababmed*sumactualmaxmagabove610
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*sumactualmaxmagabove610
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*sumactualmaxmagabove610
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop  yearsdemocracy rulpartyinstit        lngdppc lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table1, append excel
* Testing equality of coefficients
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop)  at((mean)   mag5above1015 depth_min actualmaxmag10_adj   yearsdemocracy rulpartyinstit    lngdppc   lnpop )  level(90) vce(unconditional)   post
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop
su year if e(sample)

* Model 5: Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    notcorr_icrg_dum#c.sumactualmaxmagabove610   dem5_polity  lngdppc  corr_icrg  lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table1, append excel
* Testing equality of coefficients
test 1.notcorr_icrg_dum#c.sumactualmaxmagabove610 =0.notcorr_icrg_dum#c.sumactualmaxmagabove610 
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove610) at(notcorr_icrg_dum=(0 1) (mean) dem5_polity  depth_min mag5above1015  actualmaxmag10_adj   corr_icrg corr_icrg   lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]
su year if e(sample)

*** Table 2: Robustness tests

** Sum of quake strengths above 5 as propensity var

* No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    sumactualmaxmagabove510 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2a, replace excel

* Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.sumactualmaxmagabove510 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2a, append excel
* Testing equality of coefficients
test 1.inc_developed#c.sumactualmaxmagabove510=0.inc_developed#c.sumactualmaxmagabove510
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove510) at(inc_developed=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj   dem5_polity  lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]


* Different elasticities of earthquake propensity variable in democracies versus autocracies (Polity definition)
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    dem5_polity#c.sumactualmaxmagabove510 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2a, append excel
* Testing equality of coefficients
test 1.dem5_polity#c.sumactualmaxmagabove510 =0.dem5_polity#c.sumactualmaxmagabove510 
* Testing equality in average marginal effect at mean co-variate values
quietly xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj dem5_polity##c.sumactualmaxmagabove510     lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
margins, dydx(sumactualmaxmagabove510) at(dem5_polity=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj     lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

* Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*sumactualmaxmagabove510
ge demoldprop=(dem5_polity)*  regimestababmed*sumactualmaxmagabove510
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*sumactualmaxmagabove510
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*sumactualmaxmagabove510
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop   yearsdemocracy rulpartyinstit         lngdppc lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2a, append excel
* Testing equality of coefficients
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop)  at((mean)   mag5above1015 depth_min actualmaxmag10_adj   yearsdemocracy rulpartyinstit    lngdppc   lnpop )  level(90) vce(unconditional)   post
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop

* Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    notcorr_icrg_dum#c.sumactualmaxmagabove510 dem5_polity  lngdppc  corr_icrg  lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2a, append excel
* Testing equality of coefficients
test 1.notcorr_icrg_dum#c.sumactualmaxmagabove510 =0.notcorr_icrg_dum#c.sumactualmaxmagabove510 
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove510) at(notcorr_icrg_dum=(0 1) (mean) dem5_polity  depth_min mag5above1015  actualmaxmag10_adj   corr_icrg corr_icrg   lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

** Sum of quake strengths above 6.5 as propensity var

* No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    sumactualmaxmagabove6point510  dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2b, replace excel

* Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.sumactualmaxmagabove6point510 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2b, append excel
* Testing equality of coefficients
test 1.inc_developed#c.sumactualmaxmagabove6point510=0.inc_developed#c.sumactualmaxmagabove6point510
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove6point510) at(inc_developed=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj   dem5_polity  lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

* Different elasticities of earthquake propensity variable in democracies versus autocracies (Polity definition)
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    dem5_polity#c.sumactualmaxmagabove6point510 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2b, append excel
* Testing equality of coefficients
test 1.dem5_polity#c.sumactualmaxmagabove6point510 =0.dem5_polity#c.sumactualmaxmagabove6point510 
* Testing equality in average marginal effect at mean co-variate values
quietly xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj dem5_polity##c.sumactualmaxmagabove6point510     lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
margins, dydx(sumactualmaxmagabove6point510) at(dem5_polity=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj     lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

* Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*sumactualmaxmagabove6point510
ge demoldprop=(dem5_polity)*  regimestababmed*sumactualmaxmagabove6point510
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*sumactualmaxmagabove6point510
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*sumactualmaxmagabove6point510
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop   yearsdemocracy rulpartyinstit         lngdppc lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2b, append excel
* Testing equality of coefficients
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop)  at((mean)   mag5above1015 depth_min actualmaxmag10_adj   yearsdemocracy rulpartyinstit    lngdppc   lnpop )  level(90) vce(unconditional)   post
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop


* Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    notcorr_icrg_dum#c.sumactualmaxmagabove6point510 dem5_polity  lngdppc  corr_icrg  lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2b, append excel
* Testing equality of coefficients
test 1.notcorr_icrg_dum#c.sumactualmaxmagabove6point510 =0.notcorr_icrg_dum#c.sumactualmaxmagabove6point510 
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove6point510) at(notcorr_icrg_dum=(0 1) (mean) dem5_polity  depth_min mag5above1015  actualmaxmag10_adj   corr_icrg corr_icrg   lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

** Max quake strength as propensity var

* No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    maxmagabove510 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2c, replace excel

* Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.maxmagabove510 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2c, append excel
* Testing equality of coefficients
test 1.inc_developed#c.maxmagabove510=0.inc_developed#c.maxmagabove510
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(maxmagabove510) at(inc_developed=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj   dem5_polity  lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

* Different elasticities of earthquake propensity variable in democracies versus autocracies 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    dem5_polity#c.maxmagabove510 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2c, append excel
* Testing equality of coefficients
test 1.dem5_polity#c.maxmagabove510=0.dem5_polity#c.maxmagabove510
* Testing equality in average marginal effect at mean co-variate values
quietly xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj dem5_polity##c.maxmagabove510     lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
margins, dydx(maxmagabove510) at(dem5_polity=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj     lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

* Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*maxmagabove510
ge demoldprop=(dem5_polity)*  regimestababmed*maxmagabove510
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*maxmagabove510
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*maxmagabove510
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop    yearsdemocracy rulpartyinstit        lngdppc lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2c, append excel
* Testing equality of coefficients
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop)  at((mean)   mag5above1015 depth_min actualmaxmag10_adj   yearsdemocracy rulpartyinstit    lngdppc   lnpop )  level(90) vce(unconditional)   post
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop


* Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    notcorr_icrg_dum#c.maxmagabove510 dem5_polity  lngdppc  corr_icrg  lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2c, append excel
* Testing equality of coefficients
test 1.notcorr_icrg_dum#c.maxmagabove510=0.notcorr_icrg_dum#c.maxmagabove510
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(maxmagabove510) at(notcorr_icrg_dum=(0 1) (mean) dem5_polity  depth_min mag5above1015  actualmaxmag10_adj   corr_icrg corr_icrg   lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]


** Only quakes of strengths equal or above 6

* No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    sumactualmaxmagabove610  dem5_polity  lngdppc   lnpop    if  maxmag_annual_incloffcoast>=6 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2d, replace excel


*** NOTE: COEFFICIENTS DIFFERENT FROM THE ONES REPORTED IN ARTICLE. HOWEVER, INFERENCE THE SAME
* Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop    if  maxmag_annual_incloffcoast>=6 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2d, append excel
* Testing equality of coefficients
test 1.inc_developed#c.sumactualmaxmagabove610=0.inc_developed#c.sumactualmaxmagabove610
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove610) at(inc_developed=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj   dem5_polity  lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

* Different elasticities of earthquake propensity variable in democracies versus autocracies (Polity definition)
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    dem5_polity#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop    if  maxmag_annual_incloffcoast>=6 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2d, append excel
* Testing equality of coefficients
test 1.dem5_polity#c.sumactualmaxmagabove610 =0.dem5_polity#c.sumactualmaxmagabove610 
* Testing equality in average marginal effect at mean co-variate values
quietly xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj dem5_polity##c.sumactualmaxmagabove610     lngdppc   lnpop    if   maxmag_annual_incloffcoast>=6 &  maxmag_annual_incloffcoast<.,  cluster(country)
margins, dydx(sumactualmaxmagabove610) at(dem5_polity=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj     lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

*** NOTE: COEFFICIENTS DIFFERENT FROM THE ONES REPORTED IN ARTICLE. HOWEVER, INFERENCE THE SAME
* Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*sumactualmaxmagabove610
ge demoldprop=(dem5_polity)*  regimestababmed*sumactualmaxmagabove610
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*sumactualmaxmagabove610
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*sumactualmaxmagabove610
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop    yearsdemocracy rulpartyinstit       lngdppc lnpop    if  maxmag_annual_incloffcoast>=6 &  maxmag_annual_incloffcoast<., cluster(country)
outreg2 using table2d, append excel
* Testing equality of coefficients
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop)  at((mean)   mag5above1015 depth_min actualmaxmag10_adj   yearsdemocracy rulpartyinstit    lngdppc   lnpop )  level(90) vce(unconditional)   post
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop


*** NOTE: COEFFICIENTS DIFFERENT FROM THE ONES REPORTED IN ARTICLE. HOWEVER, INFERENCE THE SAME
* Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    notcorr_icrg_dum#c.sumactualmaxmagabove610 dem5_polity  lngdppc  corr_icrg  lnpop    if  maxmag_annual_incloffcoast>=6 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2d, append excel
* Testing equality of coefficients
test 1.notcorr_icrg_dum#c.sumactualmaxmagabove610 =0.notcorr_icrg_dum#c.sumactualmaxmagabove610 
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove610) at(notcorr_icrg_dum=(0 1) (mean) dem5_polity  depth_min mag5above1015  actualmaxmag10_adj   corr_icrg corr_icrg   lngdppc   lnpop )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

*** Sum of weighted quakes of magnitude equal or above 6 between 1900 and 1960 as propensity measure (data taken from USGS)

* Model 1: No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min   actualmaxmag10_adj     usgs_mag_10_pre1960  dem5_polity  lngdppc   lnpop    if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2e, replace excel

* Model 2: * Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
capture drop dev_usgs_mag_10_pre1960 notdev_usgs_mag_10_pre1960
ge dev_usgs_mag_10_pre1960=inc_developed* usgs_mag_10_pre1960  
ge notdev_usgs_mag_10_pre1960=(1-inc_developed)* usgs_mag_10_pre1960  
xi: nbreg killed_earthquake  mag5above1015 depth_min   actualmaxmag10_adj  notdev_usgs_mag_10_pre1960   dev_usgs_mag_10_pre1960 dem5_polity  lngdppc   lnpop    if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
* Testing equality of coefficients
test dev_usgs_mag_10_pre1960=notdev_usgs_mag_10_pre1960
outreg2 using table2e, append excel
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(notdev_usgs_mag_10_pre1960   dev_usgs_mag_10_pre1960) at((mean)   mag5above1015 depth_min actualmaxmag10_adj   dem5_polity  lngdppc   lnpop )  level(90) vce(unconditional)   post
test dev_usgs_mag_10_pre1960=notdev_usgs_mag_10_pre1960

* Model 3: Different elasticities of earthquake propensity variable in democracies versus autocracies (Polity definition)
capture drop dem_usgs_mag_10_pre1960 aut_usgs_mag_10_pre1960
ge dem_usgs_mag_10_pre1960=dem5_polity* usgs_mag_10_pre1960  
ge aut_usgs_mag_10_pre1960=(1-dem5_polity)* usgs_mag_10_pre1960  
xi: nbreg killed_earthquake  mag5above1015  depth_min   actualmaxmag10_adj  aut_usgs_mag_10_pre1960  dem_usgs_mag_10_pre1960  dem5_polity  lngdppc   lnpop    if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
* Testing equality of coefficients
test dem_usgs_mag_10_pre1960=aut_usgs_mag_10_pre1960
outreg2 using table2e, append excel
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(aut_usgs_mag_10_pre1960  dem_usgs_mag_10_pre1960) at((mean)   mag5above1015 depth_min actualmaxmag10_adj   dem5_polity  lngdppc   lnpop )  level(90) vce(unconditional)   post
test aut_usgs_mag_10_pre1960 = dem_usgs_mag_10_pre1960

* Model 4: Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)* usgs_mag_10_pre1960
ge demoldprop=(dem5_polity)*  regimestababmed* usgs_mag_10_pre1960
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)* usgs_mag_10_pre1960
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed* usgs_mag_10_pre1960
xi: nbreg killed_earthquake  mag5above1015  depth_min  actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop  yearsdemocracy rulpartyinstit        lngdppc lnpop    if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2e, append excel
* Testing equality of coefficients
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop)  at((mean)   mag5above1015 depth_min actualmaxmag10_adj   yearsdemocracy rulpartyinstit    lngdppc   lnpop )  level(90) vce(unconditional)   post
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop


* Model 5: Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
capture drop corr_usgs_mag_10_pre1960 notcorr_usgs_mag_10_pre1960
ge notcorr_usgs_mag_10_pre1960=notcorr_icrg_dum* usgs_mag_10_pre1960  
ge corr_usgs_mag_10_pre1960=(1-notcorr_icrg_dum)* usgs_mag_10_pre1960  
xi: nbreg killed_earthquake  mag5above1015 depth_min   actualmaxmag10_adj    corr_usgs_mag_10_pre1960  notcorr_usgs_mag_10_pre1960    dem5_polity  lngdppc  corr_icrg  lnpop    if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
* Testing equality of coefficients
test notcorr_usgs_mag_10_pre1960=corr_usgs_mag_10_pre1960
outreg2 using table2e, append excel
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(corr_usgs_mag_10_pre1960  notcorr_usgs_mag_10_pre1960 ) at((mean)   mag5above1015 depth_min actualmaxmag10_adj   dem5_polity  lngdppc  corr_icrg lnpop )  level(90) vce(unconditional)   post
test corr_usgs_mag_10_pre1960 = notcorr_usgs_mag_10_pre1960 

** Leader years in office included 

* No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    sumactualmaxmagabove610  dem5_polity  lngdppc   lnpop  yrsoffc  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2f, replace excel

* Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop  yrsoffc  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
* Testing equality of coefficients
test 1.inc_developed#c.sumactualmaxmagabove610=0.inc_developed#c.sumactualmaxmagabove610
outreg2 using table2f, append excel
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove610) at(inc_developed=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj   dem5_polity  lngdppc   lnpop yrsoffc )  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

* Different elasticities of earthquake propensity variable in democracies versus autocracies (Polity definition)
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    dem5_polity#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop  yrsoffc  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
* Testing equality of coefficients
test 1.dem5_polity#c.sumactualmaxmagabove610 =0.dem5_polity#c.sumactualmaxmagabove610 
outreg2 using table2f, append excel
* Testing equality in average marginal effect at mean co-variate values
quietly xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj dem5_polity##c.sumactualmaxmagabove610     lngdppc   lnpop yrsoffc   if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
margins, dydx(sumactualmaxmagabove610) at(dem5_polity=(0 1) (mean)   mag5above1015 depth_min actualmaxmag10_adj     lngdppc   lnpop yrsoffc)  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]

* Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*sumactualmaxmagabove610
ge demoldprop=(dem5_polity)*  regimestababmed*sumactualmaxmagabove610
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*sumactualmaxmagabove610
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*sumactualmaxmagabove610
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop   yearsdemocracy rulpartyinstit         lngdppc lnpop  yrsoffc  if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
outreg2 using table2f, append excel
* Testing equality of coefficients
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop)  at((mean)   mag5above1015 depth_min actualmaxmag10_adj   yearsdemocracy rulpartyinstit    lngdppc   lnpop yrsoffc)  level(90) vce(unconditional)   post
test  demyoungprop=  demoldprop
test  demyoungprop= autocyrsoffcabmedprop
test  demoldprop= autocyrsoffcabmedprop
test  autocyrsoffcbelmedprop= autocyrsoffcabmedprop


* Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    notcorr_icrg_dum#c.sumactualmaxmagabove610 dem5_polity  lngdppc  corr_icrg  lnpop yrsoffc     if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)
* Testing equality of coefficients
test 1.notcorr_icrg_dum#c.sumactualmaxmagabove610 =0.notcorr_icrg_dum#c.sumactualmaxmagabove610 
outreg2 using table2f, append excel
* Testing equality in average marginal effect at mean co-variate values
margins, dydx(sumactualmaxmagabove610) at(notcorr_icrg_dum=(0 1) (mean) dem5_polity  depth_min mag5above1015  actualmaxmag10_adj   corr_icrg corr_icrg   lngdppc   lnpop yrsoffc)  level(90) vce(unconditional)   post 
test _b[2._at] = _b[1._at]




*** Table 3: monte carlo simulation for quake fatalities, random measurement error

discard
clear
set more off




* create the test data for the monte carlo experiment



	postutil clear
	capture program drop quakesim	
	program quakesim
	version 8.0
	
	set seed 10010

	tempname quake1
	
	postfile `quake1' b_mag5above1015 se_mag5above1015 b_depth_min se_depth_min b_actualmaxmag10_adj se_actualmaxmag10_adj b_sumactualmaxmagabove610 se_sumactualmaxmagabove610 /*
			*/ b_dem5_polity se_dem5_polity b_lngdppc se_lngdppc b_lnpop se_lnpop using quake1, replace

	tempname quake2
	
	postfile `quake2' b_mag5above1015 se_mag5above1015 b_depth_min se_depth_min b_actualmaxmag10_adj se_actualmaxmag10_adj b_0devsumactualmaxmagabove610 se_0devsumactualmaxmagabove610 b_1devsumactualmaxmagabove610 se_1devsumactualmaxmagabove610 /*
			*/ b_dem5_polity se_dem5_polity b_lngdppc se_lngdppc b_lnpop se_lnpop using quake2, replace

	tempname quake3
	
	postfile `quake3' b_mag5above1015 se_mag5above1015 b_depth_min se_depth_min b_actualmaxmag10_adj se_actualmaxmag10_adj b_0demsumactualmaxmagabove610 se_0demsumactualmaxmagabove610 b_1demsumactualmaxmagabove610 se_1demsumactualmaxmagabove610 /*
			*/ b_dem5_polity se_dem5_polity b_lngdppc se_lngdppc b_lnpop se_lnpop using quake3, replace

	tempname quake4
	
	postfile `quake4' b_mag5above1015 se_mag5above1015 b_depth_min se_depth_min b_actualmaxmag10_adj se_actualmaxmag10_adj /*
			*/ b_demyoungprop se_demyoungprop /*
			*/ b_demoldprop se_demoldprop /*
			*/ b_autocyrsoffcabmedprop se_autocyrsoffcabmedprop /*
			*/ b_autocyrsoffcbelmedprop se_autocyrsoffcbelmedprop /*
			*/ b_yearsdemocracy se_yearsdemocracy b_rulpartyinstit  se_rulpartyinstit  /*
			*/ b_lngdppc se_lngdppc b_lnpop se_lnpop using quake4, replace
			
	tempname quake5
	
	postfile `quake5' b_mag5above1015 se_mag5above1015 b_depth_min se_depth_min b_actualmaxmag10_adj se_actualmaxmag10_adj /*
			*/ b_0ncsumactualmaxmag se_0ncsumactualmaxmag /*
			*/ b_1ncsumactualmaxmag se_1ncsumactualmaxmag /*
			*/ b_dem5_polity se_dem5_polity b_corr_icrg se_corr_icrg b_lngdppc se_lngdppc b_lnpop se_lnpop using quake5, replace


			
	qui {	

	forvalues i = 1/100 {
	
	drop _all
	
	use "Article for World Development (earthquakes).dta", clear
	
	gen choice=runiform()
	
	gen measurelow=0.5+runiform()

	gen measurehigh=(0.5+runiform())*2
	replace measurehigh=(0.5+runiform())/2 if runiform()<.5

	gen quakekill_hlp= killed_earthquake

	replace quakekill_hlp= killed_earthquake*measurelow if choice>0.85 
	replace quakekill_hlp= killed_earthquake*measurehigh if choice>0.85 & (inc_developed==0 | dem5_polity==0)
	gen killed_earthquake_sim=round(quakekill_hlp) 
	drop quakekill_hlp	

	nbreg killed_earthquake_sim  mag5above1015  depth_min actualmaxmag10_adj    sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop    if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country) nolrtest


	post `quake1' (_b[mag5above1015]) (_se[mag5above1015]) (_b[depth_min]) (_se[depth_min]) (_b[actualmaxmag10_adj]) (_se[actualmaxmag10_adj]) (_b[sumactualmaxmagabove610]) (_se[sumactualmaxmagabove610]) /*
			*/  (_b[dem5_polity]) (_se[dem5_polity]) (_b[lngdppc]) (_se[lngdppc]) (_b[lnpop]) (_se[lnpop]) 

	nbreg killed_earthquake_sim  mag5above1015  depth_min  actualmaxmag10_adj    inc_developed#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop    if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country) nolrtest


	post `quake2' (_b[mag5above1015]) (_se[mag5above1015]) (_b[depth_min]) (_se[depth_min]) (_b[actualmaxmag10_adj]) (_se[actualmaxmag10_adj]) (_b[0.inc_developed#sumactualmaxmagabove610]) (_se[0.inc_developed#sumactualmaxmagabove610]) /*
			*/ (_b[1.inc_developed#sumactualmaxmagabove610]) (_se[1.inc_developed#sumactualmaxmagabove610]) (_b[dem5_polity]) (_se[dem5_polity]) (_b[lngdppc]) (_se[lngdppc]) (_b[lnpop]) (_se[lnpop]) 

	nbreg killed_earthquake_sim  mag5above1015  depth_min  actualmaxmag10_adj    dem5_polity#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop    if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country) nolrtest


	post `quake3' (_b[mag5above1015]) (_se[mag5above1015]) (_b[depth_min]) (_se[depth_min]) (_b[actualmaxmag10_adj])  (_se[actualmaxmag10_adj]) (_b[0.dem5_polity#sumactualmaxmagabove610]) (_se[0.dem5_polity#sumactualmaxmagabove610]) /*
			*/ (_b[1.dem5_polity#sumactualmaxmagabove610]) (_se[1.dem5_polity#sumactualmaxmagabove610]) (_b[dem5_polity]) (_se[dem5_polity]) (_b[lngdppc]) (_se[lngdppc]) (_b[lnpop]) (_se[lnpop]) 

	capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
	ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*sumactualmaxmagabove610
	ge demoldprop=(dem5_polity)*  regimestababmed*sumactualmaxmagabove610
	ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*sumactualmaxmagabove610
	ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*sumactualmaxmagabove610
	nbreg killed_earthquake_sim  mag5above1015 depth_min   actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop   yearsdemocracy rulpartyinstit    lngdppc lnpop   if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country) nolrtest

	post `quake4' (_b[mag5above1015]) (_se[mag5above1015]) (_b[depth_min]) (_se[depth_min]) (_b[actualmaxmag10_adj]) (_se[actualmaxmag10_adj]) /*
			*/ (_b[demyoungprop]) (_se[demyoungprop]) /*
			*/ (_b[demoldprop]) (_se[demoldprop]) /*
			*/ (_b[autocyrsoffcabmedprop]) (_se[autocyrsoffcabmedprop]) /*
			*/ (_b[autocyrsoffcbelmedprop]) (_se[autocyrsoffcbelmedprop]) /*
			*/ (_b[yearsdemocracy]) (_se[yearsdemocracy]) /*
			*/ (_b[rulpartyinstit]) (_se[rulpartyinstit]) /*
			*/ (_b[lngdppc]) (_se[lngdppc]) (_b[lnpop]) (_se[lnpop]) 
			
	nbreg killed_earthquake_sim  mag5above1015 depth_min   actualmaxmag10_adj    notcorr_icrg_dum#c.sumactualmaxmagabove610 dem5_polity  lngdppc  corr_icrg  lnpop    if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country) nolrtest

	post `quake5' (_b[mag5above1015]) (_se[mag5above1015]) (_b[depth_min]) (_se[depth_min]) (_b[actualmaxmag10_adj]) (_se[actualmaxmag10_adj]) /*
			*/ (_b[0.notcorr_icrg_dum#c.sumactualmaxmagabove610]) (_se[0.notcorr_icrg_dum#c.sumactualmaxmagabove610]) /*
			*/ (_b[1.notcorr_icrg_dum#c.sumactualmaxmagabove610]) (_se[1.notcorr_icrg_dum#c.sumactualmaxmagabove610]) /*
			*/ (_b[dem5_polity]) (_se[dem5_polity]) (_b[corr_icrg]) (_se[corr_icrg]) (_b[lngdppc]) (_se[lngdppc]) (_b[lnpop]) (_se[lnpop]) 
			
			
			
			
	drop choice measure* killed_earthquake_sim

		}
	
	}


	postclose `quake1'
	postclose `quake2'
	postclose `quake3'
	postclose `quake4'
	postclose `quake5'

	end
	
di "NOTE: The simulations will take a few minutes. Please wait..."
di ""
	
	quakesim
use "quake1.dta", clear
su  b_sumactualmaxmagabove610 se_sumactualmaxmagabove610

use "quake2.dta", clear
su  b_0devsumactualmaxmagabove610 se_0devsumactualmaxmagabove610 b_1devsumactualmaxmagabove610 se_1devsumactualmaxmagabove610

use "quake3.dta", clear
su  b_0demsumactualmaxmagabove610 se_0demsumactualmaxmagabove610 b_1demsumactualmaxmagabove610 se_1demsumactualmaxmagabove610

use "quake4.dta", clear
su  b_autocyrsoffcabmedprop se_autocyrsoffcabmedprop b_autocyrsoffcbelmedprop se_autocyrsoffcbelmedprop b_demoldprop se_demoldprop b_demyoungprop se_demyoungprop

use "quake5.dta", clear
su  b_0ncsumactualmaxmag se_0ncsumactualmaxmag b_1ncsumactualmaxmag se_1ncsumactualmaxmag	





**** Further robustness tests, not reported in tables

** Max quake strength as propensity var, not counting the quake in year of observation

* No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    maxmagabove510_notcurr dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.maxmagabove510_notcurr dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in democracies versus autocracies 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    dem5_polity#c.maxmagabove510_notcurr dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*maxmagabove510_notcurr
ge demoldprop=(dem5_polity)*  regimestababmed*maxmagabove510_notcurr
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*maxmagabove510_notcurr
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*maxmagabove510_notcurr
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop    yearsdemocracy rulpartyinstit        lngdppc lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    notcorr_icrg_dum#c.maxmagabove510_notcurr dem5_polity  lngdppc  corr_icrg  lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

** % Population living in urban areas included 

* No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    sumactualmaxmagabove610  dem5_polity  lngdppc   lnpop  urban_share  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop  urban_share  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in democracies versus autocracies (Polity definition)
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    dem5_polity#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop  urban_share  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*sumactualmaxmagabove610
ge demoldprop=(dem5_polity)*  regimestababmed*sumactualmaxmagabove610
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*sumactualmaxmagabove610
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*sumactualmaxmagabove610
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop   yearsdemocracy rulpartyinstit         lngdppc lnpop  urban_share  if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    notcorr_icrg_dum#c.sumactualmaxmagabove610 dem5_polity  lngdppc  corr_icrg  lnpop urban_share     if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

** First three models for post-1975 sample

* No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    sumactualmaxmagabove610  dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<. & year>=1975,  cluster(country)

* Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<. & year>=1975,  cluster(country)

* Different elasticities of earthquake propensity variable in democracies versus autocracies (Polity definition)
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    dem5_polity#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop    if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<. & year>=1975,  cluster(country)

** Model 2 with OECD instead of high-income dummy variable
* Different elasticities of earthquake propensity variable in OECD versus non-OECD countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_highoecd#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop  urban_share  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

** Continent fixed effects included 

* No interaction effect 
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    sumactualmaxmagabove610  dem5_polity  lngdppc   lnpop   america africa europe  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in high-income versus non-high-income countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    inc_developed#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop   america africa europe  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in democracies versus autocracies (Polity definition)
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    dem5_polity#c.sumactualmaxmagabove610 dem5_polity  lngdppc   lnpop   america africa europe  if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in old/young democracies and high/low institutionalized autocracies
capture drop demyoungprop demoldprop autocyrsoffcbelmedprop autocyrsoffcabmedprop
ge demyoungprop=(dem5_polity)*  (1-regimestababmed)*sumactualmaxmagabove610
ge demoldprop=(dem5_polity)*  regimestababmed*sumactualmaxmagabove610
ge autocyrsoffcbelmedprop=(1-dem5_polity)*  (1-yearsoffcautocratsabmed)*sumactualmaxmagabove610
ge autocyrsoffcabmedprop=(1-dem5_polity)*  yearsoffcautocratsabmed*sumactualmaxmagabove610
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    autocyrsoffcabmedprop autocyrsoffcbelmedprop demoldprop demyoungprop   yearsdemocracy rulpartyinstit         lngdppc lnpop   america africa europe  if   maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

* Different elasticities of earthquake propensity variable in corrupt versus non-corrupt countries
xi: nbreg killed_earthquake  mag5above1015 depth_min    actualmaxmag10_adj    notcorr_icrg_dum#c.sumactualmaxmagabove610 dem5_polity  lngdppc  corr_icrg  lnpop  america africa europe     if  maxmag_annual_incloffcoast>=5 &  maxmag_annual_incloffcoast<.,  cluster(country)

